<%
  if (binary == "not_available") {
%>
<p class="warning">
  Binary statistics not available.
</p>
<% } else { %>
<%
  var sections = {'queue_procs'         : ['queue',  'Queues'],
                  'queue_slave_procs'   : ['queue',  'Queues (slaves)'],
                  'connection_readers'  : ['conn',   'Connection readers'],
                  'connection_writers'  : ['conn',   'Connection writers'],
                  'connection_channels' : ['conn',   'Connection channels'],
                  'connection_other'    : ['conn',   'Connections (other)'],
                  'msg_index'           : ['table',  'Message store index'],
                  'mgmt_db'             : ['table',  'Management database'],
                  'plugins'             : ['proc',   'Plugins'],
                  'other'               : ['system', 'Other binary references']};
   var total_out = [];
%>
<%= format('memory-bar', {sections: sections, memory: binary, total_out: total_out}) %>
<span class="clear">&nbsp;</span>
<div class="box">
<%
var key = [[{name: 'Queues', colour: 'queue',
             keys: [['queue_procs',         'queues'],
                    ['queue_slave_procs',   'slaves']]}],

           [{name: 'Connections', colour: 'conn',
             keys: [['connection_readers',  'readers'],
                    ['connection_writers',  'writers'],
                    ['connection_channels', 'channels'],
                    ['connection_other',    'other']]}],

           [{name: 'Tables', colour: 'table',
             keys: [['msg_index',           'message store index'],
                    ['mgmt_db',             'management database']]}],

           [{name: 'Processes', colour: 'proc',
             keys: [['plugins',             'plugins']]},
            {name: 'System', colour: 'system',
             keys: [['other',               'other']]}]];
%>
<%= format('memory-table', {key: key, memory: binary}) %>
</div>

<div class="memory-info">
  Last updated: <b><%= fmt_date(new Date()) %></b>.<br/>
  Total referenced binaries at last update: <b><%= fmt_bytes(total_out[0]) %></b>
  <span class="help" id="binary-use"></span>
</div>

<% } %>
